
$(document).ready(function(){
    injectCustomJs("js/vertx.js");
    show_play_btn_vertx();
});

function show_play_btn_vertx(){
    $("<div class='fixed' style=\"width:50px;height:50px;bottom:300px;right:10px; position:fixed;z-index: 999999999999; background: red;\" onclick='vertx_play();'></div>").appendTo('body');
}

function vertx_play(){
    var currurl = window.location.href
    let tempwindow = window.open('_blank');
    tempwindow.location = 'http://dfj.vlook.top:8091/play.html?purl=' + currurl;
}

function injectCustomJs(jsPath)
{
    jsPath = jsPath || 'js/inject.js';
    var temp = document.createElement('script');
    temp.setAttribute('type', 'text/javascript');
    // 获得的地址类似：chrome-extension://ihcokhadfjfchaeagdoclpnjdiokfakg/js/inject.js
    temp.src = chrome.extension.getURL(jsPath);
    temp.onload = function()
    {
        // 放在页面不好看，执行完后移除掉
        // this.parentNode.removeChild(this);
    };
    document.body.appendChild(temp);
}


